/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package contextListener;

import dao.PlayerDao;
import Connection.Rebuild;
import dao.AccountDao;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import model.AccountManager;

/**
 *
 * @author Kenneth Veenstra <kenneth.veenstra@gmail.com>
 */
public class ContextListener implements ServletContextListener
{
    @Override
    public void contextInitialized( ServletContextEvent sce )
    {
        ServletContext context = sce.getServletContext();
        /* Account */
        AccountDao accountDao = new AccountDao();
        context.setAttribute("accountDao", accountDao);
        sce.getServletContext().setAttribute("accountDao", accountDao);
        /* Player */
        PlayerDao playerDao = new PlayerDao();
        context.setAttribute("playerDao", playerDao);
        sce.getServletContext().setAttribute("playerDao", playerDao);
//        String dbLocation = context.getInitParameter( "dblocation" );
    }

    @Override
    public void contextDestroyed( ServletContextEvent Sce )
    {
    }
}
